from django.conf.urls import url

from users.views import RegisterUsernameCountAPIView, RegisterMobileAPIView, RegisterAPIView, UserInfoAPIView, \
    EmailSendAPIVIew,ActiveEmailAPIView, AddAddressAPIView
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    # #/users/usernames/(?P<username>\w{5,20})/count/
    url(r'^usernames/(?P<username>\w{5,20})/count/$', RegisterUsernameCountAPIView.as_view()),
    # GET /users/phones/(?P<mobile>1[345789]\d{9})/count/
    # r'^phones/(?P<mobile>1[3,9]\d{9})/count/$' 错误写法
    # r'^phones/(?P<mobile>1[3456789]\d{9})/count/$'　正确写法
    url(r'^phones/(?P<mobile>1[3456789]\d{9})/count/$',RegisterMobileAPIView.as_view()),
    url(r'^$',RegisterAPIView.as_view()),
    url(r'^auths/$',obtain_jwt_token),
    url(r'^infos/$',UserInfoAPIView.as_view()),
    url(r'^emails/$',EmailSendAPIVIew.as_view()),
    # url(r'^addresses/$',AddAdressAPIView.as_view()),
    url(r'^emails/verification/$',ActiveEmailAPIView.as_view()),
    url(r'^addresses/$',AddAddressAPIView.as_view()),
]